import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import { ConfigProvider } from 'antd';
import { BrowserRouter } from 'react-router-dom';
import reportWebVitals from './reportWebVitals';
import store from "./redux/store";


const root = ReactDOM.createRoot(document.getElementById('root'));

root.render(
  // <React.StrictMode>
  <BrowserRouter >
    <ConfigProvider
      theme={{
        token: {
          colorPrimary: '#ED4192',
        },
      }}
    >
      <App />
    </ConfigProvider>
  </BrowserRouter>
  // </React.StrictMode>
);


//检测redux中状态的变化，只要变化，就重新渲染app，不用担心性能的问题，react的diff算法会降低重复使用率
store.subscribe(() => {
  root.render(
    // <React.StrictMode>
    <BrowserRouter >
      <ConfigProvider
        theme={{
          token: {
            colorPrimary: '#ED4192',
          },
        }}
      >
        <App />
      </ConfigProvider>
    </BrowserRouter>
    // </React.StrictMode>
  );
})

reportWebVitals();
